<?PHP

		$deleted=FALSE;
		$post=$_POST;
		
if($_POST['delete']=='delete')
{
		mp('delete');
		rp($_GET['id']);
		
		delete_sql($table,$id,$_GET['id'],FALSE);
	
		printmessage('Successfully Deleted');
		$deleted=TRUE;
}
else if($_POST['cmd']=='add' && !empty($_POST['artist']) && !empty($_POST['album']) )
{
	
	for($x=1;$x<=30;$x++)
	{
		
		if(!empty($_POST['name'.$x]) && $_POST['file'.$x]!='mp3:')
		{
			
			
			$multipost[$x]=$post;
			$multipost[$x]=process_default_serialized_values($multipost[$x]);
			$multipost[$x]['name']=$multipost[$x]['name'.$x];
			$multipost[$x]['file']=$multipost[$x]['file'.$x];
			$multipost[$x]['duration']=$multipost[$x]['duration'.$x];
			$multipost[$x]['composer']=$multipost[$x]['composer'.$x];
			process_sql_post($multipost[$x],$table,'add',NULL,NULL);
			printmessage('Successfully Added: '.$multipost[$x]['name']);
		}
		
	}
		
}
else if($_POST['cmd']=='edit')
{

		$post=process_default_serialized_values($post);
		process_sql_post($post,$table,'update',$id,$_GET[$id]);
		printmessage('Successfully Modified');
}

if($_GET['cmd']=='edit' && isset($_GET[$id]) && !$deleted)
{
		$e=get_data_form($table,$id);

	if($e['serial'] == 'N;' || empty($e['serial']) )
	{
	
			
	}
	else
	{
			$serial=unserialize($e['serial']);
			$e=array_merge($e,$serial);	
	}
	
	
}
else
{
		$_GET['cmd']='add';
}

?>